﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace Dal
{
    public class productGoldDao
    {
        public static DataSet getProductGold(string ambiente){
            string cnx = Credentials.getCredentias(ambiente);
            if (cnx == null) return null;
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = new SqlConnection(cnx);
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = "dms_Report_Product_Gold";
            cmd.CommandTimeout = 0;
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataTable dt = new DataTable("productGold");
            try
            {
                cmd.Connection.Open();
                da.Fill(dt);
                cmd.Connection.Close();
            }
            catch (Exception ex)
            {
                Credentials.writeLogFile("getProductGold: " + ex.Message);
                return null;
            }
            DataSet ds = new DataSet("productGoldDS");
            ds.Tables.Add(dt);
            cmd.Connection.Close();
            return ds;
        }            

    }
}
